<!DOCTYPE HTML>
<html>
<head>
<title>Courses</title>
<!--script src="lib/jquery/jquery-1.3.2.js"--><!--/script-->
<!--script src="http://code.google.com/apis/gears/gears_init.js"--><!--/script-->
<!--script src="js/mainPage.js"--> <!--/script-->

<style type="text/css">
a:link {color:#FFFFFF;}    /* unvisited link */
a:visited {color:#FF0000;} /* visited link */
a:hover {color:#FFFF00;}   /* mouse over link */
a:active {color:#FF8040;}  /* selected link */
</style>

</head>
<!--------------------------------------------------------Design part of the code---------------------------------------------->
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginheight="0" marginwidth="0" bgcolor="#000066">

<table border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="#000066">
  <tr>
  <td><img src="../images/jsu_banner.jpg"></td>
  </tr>
</table>

<table border="0" width="100%" bgcolor="#000000" cellspacing="0" cellpadding="0">
  <tr>
  <center><td width="100%"><font color="#FFFFFF" face="Arial" size="2"><b>D.O.R.S. Jackson State University Edition</b></font></td></center>
     <?php
	session_start();
	$JNo = $_SESSION['JNo'];
	echo "<center><td width='100%'><font color='#FFFFFF' face='Arial' size='2'><b>JSU ID: $JNo</b></font></td></center>";
  ?>
  </tr>
</table>

<p align=right> 
 
  <?php
	echo "<a href = 'logout.php'><font face='Arial Black' size='5.3' color='#ffffff'><b>Logout</b></font></a>";
  ?> 
  </p>

<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td width="18%" bgcolor="#000066" valign="top">&nbsp;


<!------------------------------------------End of Design-------------------------------------------------------->


<center>
<img src="../images/logo.jpg">
</center>

<center>
<img src="../images/courses_sign.jpg">
</center>

<center>
<table>
<tr>
<td><b><a href="http://localhost/OnlineSystem/WebContent/financialAidPage.php">Financial Aid</b></a></td>
<td><b><a href="http://localhost/OnlineSystem/WebContent/accountSummaryPage.php">Account Summary</b></a></td>
<td><b><a href="http://localhost/OnlineSystem/WebContent/purchaseBookPage.php">Purchase Your Books</b></a></td>
<td><b><a href="http://localhost/OnlineSystem/WebContent/selectCourses.php">Choose Courses</b></a></td>
</tr>
</table>
</center>


<center>
<!-- Course Page -->
<table border="3" width="25%" cellspacing="0" cellpadding="0" bgcolor="#F0F8FF">
<tr> 
<td><b>CRN</b></td>
<td><b>Subject</b></td>
<td><b>Course No.</b></td>
<td><b>Section</b></td>
<td><b>Hours</b></td>
<td><b>Title</b></td>
<td><b>Location</b></td>
<td><b>Days</b></td>
<td><b>Time</b></td>
<td><b>Capacity</b></td>
<td><b>Enrolled</b></td>
<td><b>Seats Remaining</b></td>
</tr>


<tr>
	<?php
		$host="localhost"; // Host name
		$username="root"; // Mysql username
		$password=""; // Mysql password
		$db_name="JSU_Database"; // Database name

		// Connect to server and select database.
		mysql_connect($host, $username, $password)or die("cannot connect");
		mysql_select_db($db_name)or die("cannot select DB: ".mysql_error());

		$JNo = $_SESSION['JNo'];
		$result = mysql_query("SELECT * FROM registration, course 
								WHERE StudentJNo = '$JNo' AND registration.CourseID = course.CourseID 
								ORDER BY CourseSubject, CourseNo");
		while ($row = mysql_fetch_row($result)){
			echo "<tr>";
			//CRN
			echo "<td>$row[2]</td>";
			//Subject -->
			echo "<td>$row[3]</td>";
			//<!--Course Number-->
			echo "<td>$row[4]</td>";
			//<!-- Section -->
			echo "<td>$row[5]</td>";
			//<!-- Hours -->
			echo "<td>$row[5]</td>";
			//<!-- Title -->
			echo "<td>$row[7]</td>";
			//<!-- Location -->
			echo "<td>$row[13]</td>";
			//Days
			echo "<td>$row[9]</td>";
			//<!-- Time -->
			echo "<td>$row[7]</td>";
			//Capacity
			echo "<td>$row[10]</td>";
			//Enrolled
			echo "<td>$row[11]</td>";
			//Remaining
			echo "<td>$row[12]</td>";
			echo "</tr>";
		}
	?>
</table>
</center>


<center><b><a href="http://localhost/OnlineSystem/WebContent/advisorMainPage.php">Help : Academic Advisor</a></b></center>

<center>
<FORM action= "accountSummaryPage.php"> 
<INPUT type="button" value="Back" name="button1" onClick="history.go(-1); return true;"> 
<INPUT type="submit" value="Next" name="button2">
</FORM>
</center>

</body>
</html>